import request from '../utils/request'

// 添加/取消收藏
export function Collected(sid) {
    return request({
        url: '/api/v0/collected/session/' + sid,
        method: 'patch',
    })
}

// 获取收藏会话列表
export function getcollectedList(page, count, params) {
    return request({
        url: '/api/v0/collected/sessions/' + page + "/" + count,
        method: 'get',
        params
    })
}

// 获取常用语列表
export function getPhrasesList(page, count) {
    return request({
        url: '/api/v0/phrases/' + page + "/" + count,
        method: 'get'
    })
}

// 添加常用语
export function addPhrases(data) {
    return request({
        url: '/api/v0/phrase',
        method: 'post',
        data
    })
}

// 删除常用语
export function delPhrases(sid) {
    return request({
        url: '/api/v0/phrase/' + sid,
        method: 'delete',
    })
}

// 修改常用语
export function editPhrases(sid, params) {
    return request({
        url: '/api/v0/phrase/' + sid,
        method: 'PATCH',
        data: params
    })
}

// 创建会话
export function creatSession(data) {
    return request({
        url: '/api/v1/session',
        method: 'post',
        data
    })
}

// 音频转文本
export function audio2text(data) {
    return request({
        url: '/api/v0/audio2text',
        method: 'post',
        data
    })
}

// 获取会话列表
export function getSessionsList(page, count, params) {
    return request({
        url: '/api/v1/sessions/' + page + "/" + count,
        method: 'get',
        params
    })
}

// 获取PPT模版
export function gettemplatesList(page, count, params) {
    return request({
        url: '/api/v0/templates/' + page + "/" + count,
        method: 'get',
        params
    })
}

// 生成PPT
export function GeneratePPT(data) {
    return request({
        url: '/api/v0/report',
        method: 'post',
        data
    })
}

// 下载ppt
export function download_report(rid) {
    return request({
        url: '/api/v0/download_report/' + rid,
        method: 'get',
    })
}

// 获取财务报告
export function getreportbyid(rid) {
    return request({
        url: '/api/v0/report/' + rid,
        method: 'get',
    })
}


// 根据日期获取会话列表
export function getSessionsListbydate(date) {
    return request({
        url: '/api/v1/sessions/' + date,
        method: 'get'
    })
}

// 获取会话详情
export function getSessionsDes(sid) {
    return request({
        url: '/api/v1/session/' + sid,
        method: 'get',
    })
}

// 删除会话
export function delSession(sid) {
    return request({
        url: '/api/v1/session/' + sid,
        method: 'delete',
    })
}

// 会话重命名
export function renSession(sid, data) {
    return request({
        url: '/api/v0/session/rename/' + sid,
        method: 'patch',
        data
    })
}


// 获取模型列表
export function getModels() {
    return request({
        url: '/api/v0/ollama/models',
        method: 'get',
    })
}


// 与大模型对话
export function dialogue(data) {
    return request({
        url: '/api/v1/dialogue',
        method: 'post',
        data,
        withCredentials: true
    })
}

// 与大模型对话（流式响应）
export function stream(data) {
    return request({
        url: '/api/v0/stream',
        method: 'post',
        data
    })
}

// 上传附件
export function attachment(data) {
    return request({
        url: '/api/v0/attachment',
        method: 'post',
        data
    })
}

export function getattachments(params) {
    return request({
        url: '/api/v0/attachments',
        method: 'get',
        params
    })
}

// 获取知识库文档列表
export function documentsList(page,count,params) {
    return request({
        url: '/api/v0/kb/documents/' + page + "/" + count,
        method: 'get',
        params
    })
}


// 删除文件
export function deleteDocuments(filename) {
    return request({
        url: '/api/v0/kb/delete/' + filename,
        method: 'delete',
    })
}


// 上传知识库文件
export function upload(data) {
    return request({
        url: '/api/v0/kb/upload',
        method: 'post',
        data
    })
}
